<?php
$fileName = basename("../".$_POST["image"]);
$pos = strrpos($fileName, '.'); 
$extension = substr($fileName, $pos+1);
switch ($extension)
{
	case 'jpg':
	header('Content-Type: image/jpeg');
	break;
	
	case 'png':
	header('Content-Type: image/png');
	break;
}
header("Content-Disposition: attachment; filename=".$fileName);
echo readfile("../".$_POST["image"]);
?>